import request from '@/config/axios'

// 原料溯源 VO
export interface ProductSourceVO {
  id: number // 主键id
  productName: string // 原料名称
  productNum: string // 原料码
  preProductName: string // 初加工名称
  preProductNum: string // 初加工码
  mealName: string // 菜品名称
  mealNum: string // 菜品码
  lastNum: string // 套餐码
}

// 原料溯源 API
export const ProductSourceApi = {
  // 查询原料溯源分页
  getProductSourcePage: async (params: any) => {
    return await request.get({ url: `/erp/product-source/page`, params })
  },

  // 查询原料溯源详情
  getProductSource: async (id: number) => {
    return await request.get({ url: `/erp/product-source/get?id=` + id })
  },

  // 新增原料溯源
  createProductSource: async (data: ProductSourceVO) => {
    return await request.post({ url: `/erp/product-source/create`, data })
  },

  // 修改原料溯源
  updateProductSource: async (data: ProductSourceVO) => {
    return await request.put({ url: `/erp/product-source/update`, data })
  },

  // 删除原料溯源
  deleteProductSource: async (id: number) => {
    return await request.delete({ url: `/erp/product-source/delete?id=` + id })
  },

  // 导出原料溯源 Excel
  exportProductSource: async (params) => {
    return await request.download({ url: `/erp/product-source/export-excel`, params })
  },

  getProductSourceList: async (params: any) => {
    return await request.get({ url: `/erp/product-source/list`, params })
  },
}
